cmake_minimum_required(VERSION 2.8)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER /opt/atk-dlrv1126-toolchain/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER /opt/atk-dlrv1126-toolchain/bin/arm-linux-gnueabihf-g++)

set(CMAKE_SYSROOT /opt/atk-dlrv1126-toolchain/arm-buildroot-linux-gnueabihf/sysroot)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations)
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-psabi)
# add_compile_options(-Wno-deprecated-declarations)
# add_compile_options(-Wno-deprecated)
add_compile_options(-Wno-psabi)
add_definitions(-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)

# add_compile_options(-lstdc++fs)
set(CMAKE_CXX_STANDARD 14)
project(testUsb C CXX)

aux_source_directory(. SRC)

include_directories(.)
include_directories(${CMAKE_SYSROOT}/usr/include/pcap)
include_directories(${PROJECT_SOURCE_DIR}/usb)
include_directories(${PROJECT_SOURCE_DIR}/mqtt)
include_directories(${PROJECT_SOURCE_DIR}/threadPool)
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/../common-rv1126/include/mosquitto)
include_directories(${PROJECT_SOURCE_DIR}/yaml/include)
include_directories(${PROJECT_SOURCE_DIR}/jsoncpp)
include_directories(${PROJECT_SOURCE_DIR}/interface)
include_directories(${PROJECT_SOURCE_DIR}/logger)
include_directories(${PROJECT_SOURCE_DIR}/spdlog)

add_definitions(-DDEV_MODBUS_VERSION="V1.0.2")

# find_library(LIBmqtt mosquitto ${PROJECT_SOURCE_DIR}/mqtt/lib)
link_directories(${PROJECT_SOURCE_DIR}/../common-rv1126/lib/mosquitto)
link_directories(${PROJECT_SOURCE_DIR}/yaml/lib)

message("source file is ${SRC}")
message("project source dir is ${PROJECT_SOURCE_DIR}")

set(TARGET dev_modbus)

add_executable(${TARGET} ${SRC})

target_link_libraries(${TARGET} usb-1.0 pthread mosquitto yaml-cpp)

# target_link_libraries(main usb-1.0 pthread mosquitto ssl crypto)
